<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUserAmountTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_amount', function (Blueprint $table) {
            $table->id();
            $table->integer('user_id')->default('0')->comment('用户ID');
            $table->decimal('pre_money')->default('0.00')->comment('变更前余额');
            $table->decimal('money')->default('0.00')->comment('变更金额');
            $table->decimal('after_money')->default('0.00')->comment('变更后余额');
            $table->text('remark')->nullable()->comment('变更备注');
            $table->tinyInteger('type')->default('0')->comment('变更类型:0=后台修改,1=订单金额,2=提现金额');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_amount');
    }
}
